import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.expected_conditions import WebDriverOrWebElement
from selenium.webdriver.support.wait import WebDriverWait

def mul_click(click_element,target_element):
    def inner(driver:WebDriverOrWebElement):
        #进行元素点击操作
        driver.find_element(*click_element).click()
        #进行目标页面的元素查找
        return driver.find_element(*target_element)
    return inner


def wait_display_demo():
    driver=webdriver.Chrome()
    driver.get("https://vip.ceshiren.com/#/ui_study/frame")
    #官方的无法解决，弃用
    # WebDriverWait(driver,10).until(expected_conditions.element_to_be_clickable((By.ID,"primary_btn")))

    WebDriverWait(driver,10).until(
        mul_click((By.ID,"primary_btn"),(By.XPATH,"//*[text()='点击两次响应']")))
    driver.find_element(By.ID,"primary_btn").click()
    time.sleep(3)

if __name__ == '__main__':
    wait_display_demo()